package com.zy.pay.converter;

import com.zy.pay.dto.OrderPayDTO;
import com.zy.pay.entity.OrderPay;
import com.zy.pay.vo.OrderPayVO;
import org.springframework.beans.BeanUtils;

/**
 * (表t_order_pay)数据转换辅助对象
 *
 * @author ZY
 * @date 2021-04-12 19:02:19
 */
public class OrderPayConverter {

    /**
     * 私有化构造器
     */
    private OrderPayConverter() {
    }

    /**
     * 实体类转DTO
     *
     * @param entity 实体类
     * @return 转换后的对象
     */
    public static OrderPayDTO covertToDTO(OrderPay entity) {
        OrderPayDTO dto = new OrderPayDTO();
        BeanUtils.copyProperties(entity, dto);
        return dto;
    }

    /**
     * 实体类转VO
     *
     * @param entity 实体类
     * @return 转换后的对象
     */
    public static OrderPayVO convertToVO(OrderPay entity) {
        OrderPayVO vo = new OrderPayVO();
        BeanUtils.copyProperties(entity, vo);
        return vo;
    }

    /**
     * DTO转实体类
     *
     * @param dto 参数对象
     * @return 转换后的实体类对象
     */
    public static OrderPay convertFromDTO(OrderPayDTO dto) {
        OrderPay entity = new OrderPay();
        BeanUtils.copyProperties(dto, entity);
        return entity;
    }

    /**
     * VO转实体类
     *
     * @param vo 参数对象
     * @return 转换后的实体类对象
     */
    public static OrderPay convertFromVO(OrderPayVO vo) {
        OrderPay entity = new OrderPay();
        BeanUtils.copyProperties(vo, entity);
        return entity;
    }

}